# favorite_languages = {
#     'jen': 'python',
#     'sarah': 'c',
#     'edward': 'ruby',
#     'phil': 'python',
# }
# print(favorite_languages)

def dic2sql(dic_list,sql):
   
    sf = ''
    for dic in dic_list:
        tup=''
        for value in dic.values():
            tup=tup+(str(value))+',' 
               
        tup=tup.rstrip(',')
        print(tup)
        sf=sf+'('+tup+')'+','
    
    sf = sf.rstrip(',')
    sql2=sql % sf
    return sql2

dic_list = [{'id': 216, 'jar': 138,'home': 118},{'id': 6, 'jar': 8,'home': 11}]
sql = "insert into users (login,userid) VALUES %s;"
dic_sql=dic2sql(dic_list,sql)
print(dic_sql,sql)